import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/6/15 21:52
 */

public class Solution {
    public int halveArray(int[] nums) {
        // 创建一个优先队列，用于存储数组中的元素，按照从大到小的顺序排列
        PriorityQueue<Double> heap = new PriorityQueue<>((a, b) -> b.compareTo(a));
        // 初始化数组的总和为0
        double sum = 0.0;
        for (int i : nums) {
            heap.offer((double) i);
            sum += i;
        }
        sum /= 2.0;

        int count = 0;
        // 当数组的总和大于目标值时，循环执行以下操作
        while (sum > 0) {
            double t = heap.poll() / 2.0;
            // 将除以2后的值从数组的总和中减去
            sum -= t;
            count++;
            // 将除以2后的值重新加入优先队列
            heap.offer(t);
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = scanner.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.halveArray(nums));
        }
    }
}